Skip to content

Adapt camera-proxy to new pyro-camera-api client#569

Merged
fe51 merged 9 commits into
mainfrom
update_camera_proxy
May 14, 2026
Merged

Adapt camera-proxy to new pyro-camera-api client#569
fe51 merged 9 commits into
mainfrom
update_camera_proxy

Conversation

@MateoLostanlen
Copy link
Copy Markdown
Member

Summary

After upted in pyro-camera-api client

  • Aligns /cameras/{id}/... proxy routes with the refreshed pyro_camera_api_client: renames pos_id → patrol_id on /capture, and adds duration / zoom
    to the legacy /control/move.
  • Exposes the new focused PTZ endpoints (preferred over the overloaded move): goto_preset, start_move, stop_move, move_for_duration, move_by_degrees,
    click_to_move, plus GET /control/speed_tables.
  • speed on /control/move_by_degrees is optional — when omitted the device auto-picks the best calibrated speed (preferred).
  • Temporarily pins pyro-camera-api-client to the calibrate_reolink_cam branch until those client changes land on develop; switch back before merge.

Rename pos_id to patrol_id on /capture, add duration/zoom to legacy
/control/move, and expose focused PTZ endpoints (goto_preset,
start_move, stop_move, move_for_duration, move_by_degrees,
click_to_move) plus /control/speed_tables.
Aligns with the client change where omitting speed lets the server
auto-pick the best calibrated level for the target angle.
@MateoLostanlen MateoLostanlen requested a review from fe51 April 16, 2026 11:38
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.11%. Comparing base (dca6654) to head (4c8a887).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #569      +/-   ##
==========================================
+ Coverage   89.92%   90.11%   +0.18%     
==========================================
  Files          55       55              
  Lines        2451     2498      +47     
==========================================
+ Hits         2204     2251      +47     
  Misses        247      247              
Flag Coverage Δ
backend 90.09% <100.00%> (+0.20%) ⬆️
client 90.40% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Member

@fe51 fe51 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @MateoLostanlen , I have made small modificaiton as suggestion

  • Introduced CameraDirection = Literal["Left", "Right", "Up", "Down"] type alias; applied it to start_move, move_for_duration, and move_by_degrees — invalid directions now return 422 instead of failing downstream
  • Added deprecated=True to the /control/move route decorator so it appears struck-through in the OpenAPI docs

Also, I have one question about /control/stop and /control/stop_move

Do these call different downstream methods that have genuinely different scopes? If yes, the summaries should reflect that:

  • stop_move → "Halt the current continuous PTZ move" ?
  • stop_camera → "Stop all camera activity" (or whatever it actually does) ?
    If they turn out to do the same thing, one of them should be removed or at least stop should be deprecated like move.

summary="Move toward a normalized image click",
)
async def proxy_click_to_move(
click_x: float = Query(..., ge=0.0, le=1.0, description="Normalized x coordinate in [0, 1]"),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would not be more robust to put x y. in the payload/body instead of a param url ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed

Upstream pyro_camera_api implements stop_move as `return stop_camera(camera_ip)`,
so /control/stop and /control/stop_move call the same downstream operation.
Pair the /control/stop deprecation with the existing /control/move deprecation,
and tighten the stop_move summary for OpenAPI clarity.
The five new POSTs introduced in this PR (goto_preset, start_move,
move_for_duration, move_by_degrees, click_to_move) now accept their
operands as a JSON body instead of query parameters. Defines small
Pydantic request models with the same validation constraints
(gt=0, ge=0.0, le=1.0). Tests parametrize updated to send JSON bodies.

POST state-changing commands belong in the body, not the URL — and
since these endpoints are net-new and unreleased, the change is free.
Switch the pyro-camera-api-client git source from the develop branch
to main, and regenerate poetry.lock so the resolved reference picks
up commit 6d525b1 which carries the new focused PTZ client methods
(goto_preset, start_move, stop_move, move_for_duration,
move_by_degrees, click_to_move, get_speed_tables). Unblocks pytest CI.
@github-actions github-actions Bot added the topic: build Related to build, installation & CI label May 14, 2026
The latest types-requests release narrowed the expected types for
`headers` (now MutableMapping[str, str | bytes]) and `json` (now
the invariant JsonType). Widen the `headers` property return type
and annotate the heterogeneous occlusion-mask payload accordingly.

Restores green mypy-client CI (red on main since dca6654).
@MateoLostanlen
Copy link
Copy Markdown
Member Author

MateoLostanlen commented May 14, 2026

Hi @fe51, fair point. Keeping /control/stop_move for symmetry with start_move, and deprecating the legacy /control/move + /control/stop together. They'll be removed in a later cleanup pass on pyro-engine + the API once the focused routes are fully adopted.

@MateoLostanlen MateoLostanlen requested a review from fe51 May 14, 2026 09:57
Copy link
Copy Markdown
Member

@fe51 fe51 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @MateoLostanlen thank you for the update ! Lets merge !

@fe51 fe51 merged commit 3a69b32 into main May 14, 2026
24 checks passed
@fe51 fe51 deleted the update_camera_proxy branch May 14, 2026 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ext: client topic: build Related to build, installation & CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants